//
//  MyShopHomeViewController.m
//  GoodWayClient
//
//  Created by HuiDong on 15/12/14.
//  Copyright © 2015年 HuiDong. All rights reserved.
//

#import "MyShopHomeViewController.h"

@interface MyShopHomeViewController ()

@end

@implementation MyShopHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 64)];//allocate titleView
    UIColor *color =  self.navigationController.navigationBar.backgroundColor;
    
    [titleView setBackgroundColor:color];
    
    UISearchBar *searchBar = [[UISearchBar alloc] init];
    
    searchBar.delegate = self;
    

    
    searchBar.frame = CGRectMake(0, 10, 200, 35);
    searchBar.backgroundColor = color;
    searchBar.layer.cornerRadius = 4.0;
    searchBar.layer.masksToBounds = YES;
    [searchBar.layer setBorderWidth:8];
    [searchBar.layer setBorderColor:[UIColor whiteColor].CGColor];  //设置边框为白色
    
    searchBar.placeholder = @"|搜索你想要的东西";
    searchBar.clearsContextBeforeDrawing=YES;
    [titleView addSubview:searchBar];
    
    //Set to titleView
    [self.navigationItem.titleView sizeToFit];
    self.navigationItem.titleView = titleView;
    NSLog(@"方法执行了");


}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    
    
}


-(void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar{
    [searchBar setShowsCancelButton:NO animated:YES];
    //self.tableView.allowsSelection=NO;
    //self.tableView.scrollEnabled=NO;
}
@end
